import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/admin',
    component: HomeView,
    children: [
        {
      path: '/home',
      name: 'home',
      component: () => import('@/views/home/index'),
      meta: {title: '首页', icon: 'home'}
    },
      {
        path: '/goods',
        name:'商品列表',
        component: () => import('@/views/goods/GoodsListView'),
        meta: {title: '商品列表',}
      },
      {
        path: '/goods/add',
        component: () => import('@/views/goods/GoodsAddView'),
        meta: {
          title: '添加商品'}
      },
      {
        path: '/category',
        component: () => import('@/views/category/CategoryListView1'),
        meta: {
          title: '类别列表'
        }
      },
      {
        path: '/category/add',
        component: () => import('@/views/category/CategoryAddNewView'),
        meta: {
          title: '添加类别'
        }
      },
      {
        path: '/brand/add',
        component: () => import('@/views/brand/BrandAddNewView'),
        meta: {
          title: '添加品牌'
        }
      },
      {
        path: '/brand',
        component: () => import('@/views/brand/BrandListView'),
        meta: {
          title: '品牌列表'
        }
      },
      {
        path: '/order',
        component: () => import('@/views/order/OrderList'),
        meta: {title: '订单列表'}
      },
      {
        path: '/order/add',
        component: () => import('@/views/order/AddOrder'),
        meta: {title: '订单详情'}
      },
      {
        path: '/orderLog',
        component: () => import('@/views/order/OrderLogList'),
        meta: {title: '订单日志'}
      },
      {
        path: '/user/add',
        component: () => import('@/views/user/AddUser'),
        meta: {title: '新增用户'}
      },
      {
        path: '/user',
        component: () => import('@/views/user/UserList'),
        meta: {title: '用户列表'}
      },
      {
        path: '/adminList',
        component: () => import('@/views/admin/AdminListView')
      },
      {
        path: '/admin/add',
        component: () => import('@/views/admin/AdminAddNewView')
      },{
        path: '/admin/role',
        component: () => import('@/views/admin/RoleListView')
      },



    ]
  },

  {
    path: '/',
    component: () => import('@/views/LoginView1')
  }


]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
